package com.liusr.template.service.impl;

import com.liusr.template.mapper.UserMapper;
import com.liusr.template.model.User;
import com.liusr.template.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Liusr
 * @date 2023/1/23
 * @package com.liusr.template.service.impl
 * @Description:
 */
@Service("userService")
public class UserServiceImpl implements UserService {

	@Autowired
	private UserMapper userMapper;

	@Override
	public boolean addUser(User user) {
		int i = userMapper.addUser(user);
		return i > 0;
	}

	@Override
	public boolean deleteUserById(Long id) {
		int i = userMapper.deleteUserById(id);
		return i > 0;
	}

	@Override
	public boolean isDeleteById(Long id) {
		int i = userMapper.isDeleteById(id);
		return i > 0;
	}

	@Override
	public boolean updateUserById(User user) {
		int i = userMapper.updateUserById(user);
		return i > 0;
	}

	@Override
	public User selectUserById(Long id) {
		return userMapper.selectUserById(id);
	}

	@Override
	public List<User> selectUserLike(String username, long age, String studentMajor) {
		return userMapper.selectUserLike(username, age, studentMajor);
	}

	@Override
	public List<User> selectAllUser() {
		return userMapper.selectAllUser();
	}
}
